<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QGLContext Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QGLContext Class Reference<br /><sup><sup>[<a href="qtopengl.html">QtOpenGL</a> module]</sup></sup></h1><p>The QGLContext class encapsulates an OpenGL rendering context.
<a href="#details">More...</a></p>

<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qglcontext.html#BindOption-enum">BindOption</a></b> { NoBindOption, InvertedYBindOption, MipmapBindOption, PremultipliedAlphaBindOption, LinearFilteringBindOption, DefaultBindOption }</li><li><div class="fn" />class <b><a href="qglcontext-bindoptions.html">BindOptions</a></b></li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qglcontext.html#QGLContext">__init__</a></b> (<i>self</i>, QGLFormat&#160;<i>format</i>, QPaintDevice&#160;<i>device</i>)</li><li><div class="fn" />int <b><a href="qglcontext.html#bindTexture">bindTexture</a></b> (<i>self</i>, QImage&#160;<i>image</i>, int&#160;<i>target</i>&#160;=&#160;GL_TEXTURE_2D, int&#160;<i>format</i>&#160;=&#160;GL_RGBA)</li><li><div class="fn" />int <b><a href="qglcontext.html#bindTexture-2">bindTexture</a></b> (<i>self</i>, QPixmap&#160;<i>pixmap</i>, int&#160;<i>target</i>&#160;=&#160;GL_TEXTURE_2D, int&#160;<i>format</i>&#160;=&#160;GL_RGBA)</li><li><div class="fn" />int <b><a href="qglcontext.html#bindTexture-3">bindTexture</a></b> (<i>self</i>, QString&#160;<i>fileName</i>)</li><li><div class="fn" />int <b><a href="qglcontext.html#bindTexture-4">bindTexture</a></b> (<i>self</i>, QImage&#160;<i>image</i>, int&#160;<i>target</i>, int&#160;<i>format</i>, BindOptions&#160;<i>options</i>)</li><li><div class="fn" />int <b><a href="qglcontext.html#bindTexture-5">bindTexture</a></b> (<i>self</i>, QPixmap&#160;<i>pixmap</i>, int&#160;<i>target</i>, int&#160;<i>format</i>, BindOptions&#160;<i>options</i>)</li><li><div class="fn" />bool <b><a href="qglcontext.html#chooseContext">chooseContext</a></b> (<i>self</i>, QGLContext&#160;<i>shareContext</i>&#160;=&#160;None)</li><li><div class="fn" />sip.voidptr <b><a href="qglcontext.html#chooseVisual">chooseVisual</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qglcontext.html#create">create</a></b> (<i>self</i>, QGLContext&#160;<i>shareContext</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qglcontext.html#deleteTexture">deleteTexture</a></b> (<i>self</i>, int&#160;<i>tx_id</i>)</li><li><div class="fn" />QPaintDevice <b><a href="qglcontext.html#device">device</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qglcontext.html#deviceIsPixmap">deviceIsPixmap</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qglcontext.html#doneCurrent">doneCurrent</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qglcontext.html#drawTexture">drawTexture</a></b> (<i>self</i>, QRectF&#160;<i>target</i>, int&#160;<i>textureId</i>, int&#160;<i>textureTarget</i>&#160;=&#160;GL_TEXTURE_2D)</li><li><div class="fn" /><b><a href="qglcontext.html#drawTexture-2">drawTexture</a></b> (<i>self</i>, QPointF&#160;<i>point</i>, int&#160;<i>textureId</i>, int&#160;<i>textureTarget</i>&#160;=&#160;GL_TEXTURE_2D)</li><li><div class="fn" />QGLFormat <b><a href="qglcontext.html#format">format</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qglcontext.html#generateFontDisplayLists">generateFontDisplayLists</a></b> (<i>self</i>, QFont&#160;<i>fnt</i>, int&#160;<i>listBase</i>)</li><li><div class="fn" />sip.voidptr <b><a href="qglcontext.html#getProcAddress">getProcAddress</a></b> (<i>self</i>, QString&#160;<i>proc</i>)</li><li><div class="fn" />bool <b><a href="qglcontext.html#initialized">initialized</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qglcontext.html#isSharing">isSharing</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qglcontext.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qglcontext.html#makeCurrent">makeCurrent</a></b> (<i>self</i>)</li><li><div class="fn" />QColor <b><a href="qglcontext.html#overlayTransparentColor">overlayTransparentColor</a></b> (<i>self</i>)</li><li><div class="fn" />QGLFormat <b><a href="qglcontext.html#requestedFormat">requestedFormat</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qglcontext.html#reset">reset</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qglcontext.html#setFormat">setFormat</a></b> (<i>self</i>, QGLFormat&#160;<i>format</i>)</li><li><div class="fn" /><b><a href="qglcontext.html#setInitialized">setInitialized</a></b> (<i>self</i>, bool&#160;<i>on</i>)</li><li><div class="fn" /><b><a href="qglcontext.html#setWindowCreated">setWindowCreated</a></b> (<i>self</i>, bool&#160;<i>on</i>)</li><li><div class="fn" /><b><a href="qglcontext.html#swapBuffers">swapBuffers</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qglcontext.html#windowCreated">windowCreated</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />bool <b><a href="qglcontext.html#areSharing">areSharing</a></b> (QGLContext&#160;<i>context1</i>, QGLContext&#160;<i>context2</i>)</li><li><div class="fn" />QGLContext <b><a href="qglcontext.html#currentContext">currentContext</a></b> ()</li><li><div class="fn" /><b><a href="qglcontext.html#setTextureCacheLimit">setTextureCacheLimit</a></b> (int&#160;<i>size</i>)</li><li><div class="fn" />int <b><a href="qglcontext.html#textureCacheLimit">textureCacheLimit</a></b> ()</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QGLContext class encapsulates an OpenGL rendering
context.</p>
<p>An OpenGL rendering context is a complete set of OpenGL state
variables. The rendering context's <a href="qgl.html#FormatOption-enum">format</a> is set in the constructor,
but it can also be set later with <a href="qglcontext.html#setFormat">setFormat</a>(). The format options
that are actually set are returned by <a href="qglcontext.html#format">format</a>(); the options you asked for
are returned by <a href="qglcontext.html#requestedFormat">requestedFormat</a>(). Note that
after a QGLContext object has been constructed, the actual OpenGL
context must be created by explicitly calling the <a href="qglcontext.html#create">create()</a> function. The <a href="qglcontext.html#makeCurrent">makeCurrent</a>() function makes this
context the current rendering context. You can make <i>no</i>
context current using <a href="qglcontext.html#doneCurrent">doneCurrent</a>(). The <a href="qglcontext.html#reset">reset</a>() function will reset the context
and make it invalid.</p>
<p>You can examine properties of the context with, e.g. <a href="qglcontext.html#isValid">isValid</a>(), <a href="qglcontext.html#isSharing">isSharing</a>(), <a href="qglcontext.html#initialized">initialized</a>(), <a href="qglcontext.html#windowCreated">windowCreated</a>() and <a href="qglcontext.html#overlayTransparentColor">overlayTransparentColor</a>().</p>
<p>If you're using double buffering you can swap the screen
contents with the off-screen buffer using <a href="qglcontext.html#swapBuffers">swapBuffers</a>().</p>
<p>Please note that QGLContext is not <a href="threads-reentrancy.html#thread-safe">thread-safe</a>.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="BindOption-enum" />QGLContext.BindOption</h3><p>A set of options to decide how to bind a texture using <a href="qglcontext.html#bindTexture">bindTexture</a>().</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QGLContext.NoBindOption</tt></td>
<td class="topAlign"><tt>0x0000</tt></td>
<td class="topAlign">Don't do anything, pass the texture straight
through.</td>
</tr>
<tr>
<td class="topAlign"><tt>QGLContext.InvertedYBindOption</tt></td>
<td class="topAlign"><tt>0x0001</tt></td>
<td class="topAlign">Specifies that the texture should be flipped
over the X axis so that the texture coordinate 0,0 corresponds to
the top left corner. Inverting the texture implies a deep copy
prior to upload.</td>
</tr>
<tr>
<td class="topAlign"><tt>QGLContext.MipmapBindOption</tt></td>
<td class="topAlign"><tt>0x0002</tt></td>
<td class="topAlign">Specifies that <a href="qglcontext.html#bindTexture">bindTexture</a>() should try to
generate mipmaps. If the GL implementation supports the
<tt>GL_SGIS_generate_mipmap</tt> extension, mipmaps will be
automatically generated for the texture. Mipmap generation is only
supported for the <tt>GL_TEXTURE_2D</tt> target.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QGLContext.PremultipliedAlphaBindOption</tt></td>
<td class="topAlign"><tt>0x0004</tt></td>
<td class="topAlign">Specifies that the image should be uploaded
with premultiplied alpha and does a conversion accordingly.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QGLContext.LinearFilteringBindOption</tt></td>
<td class="topAlign"><tt>0x0008</tt></td>
<td class="topAlign">Specifies that the texture filtering should be
set to GL_LINEAR. Default is GL_NEAREST. If mipmap is also enabled,
filtering will be set to GL_LINEAR_MIPMAP_LINEAR.</td>
</tr>
<tr>
<td class="topAlign"><tt>QGLContext.DefaultBindOption</tt></td>
<td class="topAlign"><tt>LinearFilteringBindOption |
InvertedYBindOption | MipmapBindOption</tt></td>
<td class="topAlign">In Qt 4.5 and earlier, <a href="qglcontext.html#bindTexture">bindTexture</a>() would mirror the
image and automatically generate mipmaps. This option helps
preserve this default behavior.</td>
</tr>
</table>
<p>Used by x11 from pixmap to choose whether or not it can bind the
pixmap upside down or not.</p>
<p>Used by paint engines to indicate that the pixmap should be
memory managed along side with the pixmap/image that it stems from,
e.g. installing destruction hooks in them.</p>
<p>This enum was introduced or modified in Qt 4.6.</p>
<p>The BindOptions type is a typedef for <a href="qflags.html">QFlags</a>&lt;BindOption&gt;. It stores an OR
combination of BindOption values.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QGLContext" />QGLContext.__init__ (<i>self</i>, <a href="qglformat.html">QGLFormat</a>&#160;<i>format</i>, <a href="qpaintdevice.html">QPaintDevice</a>&#160;<i>device</i>)</h3><p>Constructs an OpenGL context with the given <i>format</i> which
specifies several display options for the context.</p>
<p>If the underlying OpenGL/Window system cannot satisfy all the
features requested in <i>format</i>, the nearest subset of features
will be used. After creation, the <a href="qglcontext.html#format">format</a>() method will return the actual
format obtained.</p>
<p>Note that after a <a href="qglcontext.html">QGLContext</a>
object has been constructed, <a href="qglcontext.html#create">create</a>() must be called explicitly to
create the actual OpenGL context. The context will be <a href="qglcontext.html#isValid">invalid</a> if it was not possible to
obtain a GL context at all.</p>
<p><b>See also</b> <a href="qglcontext.html#format">format</a>()
and <a href="qglcontext.html#isValid">isValid</a>().</p>


<h3 class="fn"><a name="areSharing" />bool QGLContext.areSharing (<a href="qglcontext.html">QGLContext</a>&#160;<i>context1</i>, <a href="qglcontext.html">QGLContext</a>&#160;<i>context2</i>)</h3><p>Returns true if <i>context1</i> and <i>context2</i> are sharing
their GL resources such as textures, shader programs, etc;
otherwise returns false.</p>
<p>This function was introduced in Qt 4.6.</p>


<h3 class="fn"><a name="bindTexture" />int QGLContext.bindTexture (<i>self</i>, <a href="qimage.html">QImage</a>&#160;<i>image</i>, int&#160;<i>target</i>&#160;=&#160;GL_TEXTURE_2D, int&#160;<i>format</i>&#160;=&#160;GL_RGBA)</h3><p>Generates and binds a 2D GL texture to the current context,
based on <i>image</i>. The generated texture id is returned and can
be used in later <tt>glBindTexture()</tt> calls.</p>
<p>The <i>target</i> parameter specifies the texture target. The
default target is <tt>GL_TEXTURE_2D</tt>.</p>
<p>The <i>format</i> parameter sets the internal format for the
texture. The default format is <tt>GL_RGBA</tt>.</p>
<p>The binding <i>options</i> are a set of options used to decide
how to bind the texture to the context.</p>
<p>The texture that is generated is cached, so multiple calls to
bindTexture() with the same <a href="qimage.html">QImage</a> will
return the same texture id.</p>
<p>Note that we assume default values for the glPixelStore() and
glPixelTransfer() parameters.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qglcontext.html#deleteTexture">deleteTexture</a>().</p>


<h3 class="fn"><a name="bindTexture-2" />int QGLContext.bindTexture (<i>self</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pixmap</i>, int&#160;<i>target</i>&#160;=&#160;GL_TEXTURE_2D, int&#160;<i>format</i>&#160;=&#160;GL_RGBA)</h3><p>This is an overloaded function.</p>
<p>Reads the compressed texture file <i>fileName</i> and generates
a 2D GL texture from it.</p>
<p>This function can load DirectDrawSurface (DDS) textures in the
DXT1, DXT3 and DXT5 DDS formats if the
<tt>GL_ARB_texture_compression</tt> and
<tt>GL_EXT_texture_compression_s3tc</tt> extensions are
supported.</p>
<p>Since 4.6.1, textures in the ETC1 format can be loaded if the
<tt>GL_OES_compressed_ETC1_RGB8_texture</tt> extension is supported
and the ETC1 texture has been encapsulated in the PVR container
format. Also, textures in the PVRTC2 and PVRTC4 formats can be
loaded if the <tt>GL_IMG_texture_compression_pvrtc</tt> extension
is supported.</p>
<p><b>See also</b> <a href="qglcontext.html#deleteTexture">deleteTexture</a>().</p>


<h3 class="fn"><a name="bindTexture-3" />int QGLContext.bindTexture (<i>self</i>, QString&#160;<i>fileName</i>)</h3><p>Generates and binds a 2D GL texture to the current context,
based on <i>image</i>. The generated texture id is returned and can
be used in later <tt>glBindTexture()</tt> calls.</p>
<p>This is an overloaded function.</p>


<h3 class="fn"><a name="bindTexture-4" />int QGLContext.bindTexture (<i>self</i>, <a href="qimage.html">QImage</a>&#160;<i>image</i>, int&#160;<i>target</i>, int&#160;<i>format</i>, <a href="qglcontext-bindoptions.html">BindOptions</a>&#160;<i>options</i>)</h3><p>This is an overloaded function.</p>
<p>Generates and binds a 2D GL texture based on <i>pixmap</i>.</p>


<h3 class="fn"><a name="bindTexture-5" />int QGLContext.bindTexture (<i>self</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pixmap</i>, int&#160;<i>target</i>, int&#160;<i>format</i>, <a href="qglcontext-bindoptions.html">BindOptions</a>&#160;<i>options</i>)</h3><p>This is an overloaded function.</p>
<p>Generates and binds a 2D GL texture to the current context,
based on <i>pixmap</i>.</p>
<p>This function was introduced in Qt 4.6.</p>


<h3 class="fn"><a name="chooseContext" />bool QGLContext.chooseContext (<i>self</i>, <a href="qglcontext.html">QGLContext</a>&#160;<i>shareContext</i>&#160;=&#160;None)</h3><p>This semi-internal function is called by <a href="qglcontext.html#create">create</a>(). It creates a
system-dependent OpenGL handle that matches the <a href="qglcontext.html#format">format</a>() of <i>shareContext</i> as
closely as possible, returning true if successful or false if a
suitable handle could not be found.</p>
<p>On Windows, it calls the virtual function <a href="qglcontext.html#choosePixelFormat">choosePixelFormat</a>(), which
finds a matching pixel format identifier. On X11, it calls the
virtual function <a href="qglcontext.html#chooseVisual">chooseVisual</a>() which finds an
appropriate X visual. On other platforms it may work
differently.</p>


<h3 class="fn"><a name="chooseVisual" />sip.voidptr QGLContext.chooseVisual (<i>self</i>)</h3><p><b>X11 only:</b> This virtual function tries to find a visual
that matches the format, reducing the demands if the original
request cannot be met.</p>
<p>The algorithm for reducing the demands of the format is quite
simple-minded, so override this method in your subclass if your
application has spcific requirements on visual selection.</p>
<p><b>See also</b> <a href="qglcontext.html#chooseContext">chooseContext</a>().</p>


<h3 class="fn"><a name="create" />bool QGLContext.create (<i>self</i>, <a href="qglcontext.html">QGLContext</a>&#160;<i>shareContext</i>&#160;=&#160;None)</h3><p>Creates the GL context. Returns true if it was successful in
creating a valid GL rendering context on the paint device specified
in the constructor; otherwise returns false (i.e. the context is
invalid).</p>
<p>After successful creation, <a href="qglcontext.html#format">format</a>() returns the set of features
of the created GL rendering context.</p>
<p>If <i>shareContext</i> points to a valid <a href="qglcontext.html">QGLContext</a>, this method will try to establish
OpenGL display list and texture object sharing between this context
and the <i>shareContext</i>. Note that this may fail if the two
contexts have different <a href="qglcontext.html#format">formats</a>. Use <a href="qglcontext.html#isSharing">isSharing</a>() to see if sharing is in
effect.</p>
<p><b>Warning:</b> Implementation note: initialization of C++ class
members usually takes place in the class constructor. <a href="qglcontext.html">QGLContext</a> is an exception because it must be
simple to customize. The virtual functions <a href="qglcontext.html#chooseContext">chooseContext</a>() (and <a href="qglcontext.html#chooseVisual">chooseVisual</a>() for X11) can be
reimplemented in a subclass to select a particular context. The
problem is that virtual functions are not properly called during
construction (even though this is correct C++) because C++
constructs class hierarchies from the bottom up. For this reason we
need a create() function.</p>
<p><b>See also</b> <a href="qglcontext.html#chooseContext">chooseContext</a>(), <a href="qglcontext.html#format">format</a>(), and <a href="qglcontext.html#isValid">isValid</a>().</p>


<h3 class="fn"><a name="currentContext" /><a href="qglcontext.html">QGLContext</a> QGLContext.currentContext ()</h3><p>Returns the current context, i.e. the context to which any
OpenGL commands will currently be directed. Returns 0 if no context
is current.</p>
<p><b>See also</b> <a href="qglcontext.html#makeCurrent">makeCurrent</a>().</p>


<h3 class="fn"><a name="deleteTexture" />QGLContext.deleteTexture (<i>self</i>, int&#160;<i>tx_id</i>)</h3><p>Removes the texture identified by <i>id</i> from the texture
cache, and calls glDeleteTextures() to delete the texture from the
context.</p>
<p><b>See also</b> <a href="qglcontext.html#bindTexture">bindTexture</a>().</p>


<h3 class="fn"><a name="device" /><a href="qpaintdevice.html">QPaintDevice</a> QGLContext.device (<i>self</i>)</h3><p>Returns the paint device set for this context.</p>
<p><b>See also</b> <a href="qglcontext.html#QGLContext">QGLContext.QGLContext</a>().</p>


<h3 class="fn"><a name="deviceIsPixmap" />bool QGLContext.deviceIsPixmap (<i>self</i>)</h3><p>Returns true if the paint device of this context is a pixmap;
otherwise returns false.</p>


<h3 class="fn"><a name="doneCurrent" />QGLContext.doneCurrent (<i>self</i>)</h3><p>Makes no GL context the current context. Normally, you do not
need to call this function; <a href="qglcontext.html">QGLContext</a> calls it as necessary.</p>


<h3 class="fn"><a name="drawTexture" />QGLContext.drawTexture (<i>self</i>, <a href="qrectf.html">QRectF</a>&#160;<i>target</i>, int&#160;<i>textureId</i>, int&#160;<i>textureTarget</i>&#160;=&#160;GL_TEXTURE_2D)</h3><p>This function supports the following use cases:</p>
<ul>
<li>On OpenGL and OpenGL ES 1.x it draws the given texture,
<i>textureId</i>, to the given target rectangle, <i>target</i>, in
OpenGL model space. The <i>textureTarget</i> should be a 2D texture
target.</li>
<li>On OpenGL and OpenGL ES 2.x, if a painter is active, not inside
a beginNativePainting / endNativePainting block, and uses the
engine with type <a href="qpaintengine.html#Type-enum">QPaintEngine.OpenGL2</a>, the
function will draw the given texture, <i>textureId</i>, to the
given target rectangle, <i>target</i>, respecting the current
painter state. This will let you draw a texture with the clip,
transform, render hints, and composition mode set by the painter.
Note that the texture target needs to be GL_TEXTURE_2D for this use
case, and that this is the only supported use case under OpenGL ES
2.x.</li>
</ul>
<p>This function was introduced in Qt 4.4.</p>


<h3 class="fn"><a name="drawTexture-2" />QGLContext.drawTexture (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>point</i>, int&#160;<i>textureId</i>, int&#160;<i>textureTarget</i>&#160;=&#160;GL_TEXTURE_2D)</h3><p>This function supports the following use cases:</p>
<ul>
<li>By default it draws the given texture, <i>textureId</i>, at the
given <i>point</i> in OpenGL model space. The <i>textureTarget</i>
should be a 2D texture target.</li>
<li>If a painter is active, not inside a beginNativePainting /
endNativePainting block, and uses the engine with type <a href="qpaintengine.html#Type-enum">QPaintEngine.OpenGL2</a>, the
function will draw the given texture, <i>textureId</i>, at the
given <i>point</i>, respecting the current painter state. This will
let you draw a texture with the clip, transform, render hints, and
composition mode set by the painter. Note that the texture target
needs to be GL_TEXTURE_2D for this use case.</li>
</ul>
<p><b>Note:</b> This function is not supported under any version of
OpenGL ES.</p>
<p>This function was introduced in Qt 4.4.</p>


<h3 class="fn"><a name="format" /><a href="qglformat.html">QGLFormat</a> QGLContext.format (<i>self</i>)</h3><p>Returns the frame buffer format that was obtained (this may be a
subset of what was requested).</p>
<p><b>See also</b> <a href="qglcontext.html#setFormat">setFormat</a>() and <a href="qglcontext.html#requestedFormat">requestedFormat</a>().</p>


<h3 class="fn"><a name="generateFontDisplayLists" />QGLContext.generateFontDisplayLists (<i>self</i>, <a href="qfont.html">QFont</a>&#160;<i>fnt</i>, int&#160;<i>listBase</i>)</h3><h3 class="fn"><a name="getProcAddress" />sip.voidptr QGLContext.getProcAddress (<i>self</i>, QString&#160;<i>proc</i>)</h3><p>Returns a function pointer to the GL extension function passed
in <i>proc</i>. 0 is returned if a pointer to the function could
not be obtained.</p>


<h3 class="fn"><a name="initialized" />bool QGLContext.initialized (<i>self</i>)</h3><p>Returns true if this context has been initialized, i.e. if
<a href="qglwidget.html#initializeGL">QGLWidget.initializeGL</a>()
has been performed on it; otherwise returns false.</p>
<p><b>See also</b> <a href="qglcontext.html#setInitialized">setInitialized</a>().</p>


<h3 class="fn"><a name="isSharing" />bool QGLContext.isSharing (<i>self</i>)</h3><p>Returns true if this context is sharing its GL context with
another <a href="qglcontext.html">QGLContext</a>, otherwise false
is returned. Note that context sharing might not be supported
between contexts with different formats.</p>


<h3 class="fn"><a name="isValid" />bool QGLContext.isValid (<i>self</i>)</h3><p>Returns true if a GL rendering context has been successfully
created; otherwise returns false.</p>


<h3 class="fn"><a name="makeCurrent" />QGLContext.makeCurrent (<i>self</i>)</h3><p>Makes this context the current OpenGL rendering context. All GL
functions you call operate on this context until another context is
made current.</p>
<p>In some very rare cases the underlying call may fail. If this
occurs an error message is output to stderr.</p>


<h3 class="fn"><a name="overlayTransparentColor" /><a href="qcolor.html">QColor</a> QGLContext.overlayTransparentColor (<i>self</i>)</h3><p>If this context is a valid context in an overlay plane, returns
the plane's transparent color. Otherwise returns an {<a href="qcolor.html#isValid">QColor.isValid</a>()}{invalid} color.</p>
<p>The returned <a href="qcolor.html">QColor</a> object will
generally work as expected only when passed as the argument to
<a href="qglwidget.html#qglColor">QGLWidget.qglColor</a>() or
<a href="qglwidget.html#qglClearColor">QGLWidget.qglClearColor</a>().
Under certain circumstances it can also be used to draw transparent
graphics with a <a href="qpainter.html">QPainter</a>.</p>


<h3 class="fn"><a name="requestedFormat" /><a href="qglformat.html">QGLFormat</a> QGLContext.requestedFormat (<i>self</i>)</h3><p>Returns the frame buffer format that was originally requested in
the constructor or <a href="qglcontext.html#setFormat">setFormat</a>().</p>
<p><b>See also</b> <a href="qglcontext.html#format">format</a>().</p>


<h3 class="fn"><a name="reset" />QGLContext.reset (<i>self</i>)</h3><p>Resets the context and makes it invalid.</p>
<p><b>See also</b> <a href="qglcontext.html#create">create</a>()
and <a href="qglcontext.html#isValid">isValid</a>().</p>


<h3 class="fn"><a name="setFormat" />QGLContext.setFormat (<i>self</i>, <a href="qglformat.html">QGLFormat</a>&#160;<i>format</i>)</h3><p>Sets a <i>format</i> for this context. The context is <a href="qglcontext.html#reset">reset</a>.</p>
<p>Call <a href="qglcontext.html#create">create</a>() to create a
new GL context that tries to match the new format.</p>
<pre class="cpp">
 <span class="type"><a href="qglcontext.html">QGLContext</a></span> <span class="operator">*</span>cx;
 <span class="comment">//  ...</span>
 <span class="type"><a href="qglformat.html">QGLFormat</a></span> f;
 f<span class="operator">.</span>setStereo(<span class="keyword">true</span>);
 cx<span class="operator">-</span><span class="operator">&gt;</span>setFormat(f);
 <span class="keyword">if</span> (<span class="operator">!</span>cx<span class="operator">-</span><span class="operator">&gt;</span>create())
     exit(); <span class="comment">// no OpenGL support, or cannot render on the specified paintdevice</span>
 <span class="keyword">if</span> (<span class="operator">!</span>cx<span class="operator">-</span><span class="operator">&gt;</span>format()<span class="operator">.</span>stereo())
     exit(); <span class="comment">// could not create stereo context</span>
</pre>
<p><b>See also</b> <a href="qglcontext.html#format">format</a>(),
<a href="qglcontext.html#reset">reset</a>(), and <a href="qglcontext.html#create">create</a>().</p>


<h3 class="fn"><a name="setInitialized" />QGLContext.setInitialized (<i>self</i>, bool&#160;<i>on</i>)</h3><p>If <i>on</i> is true the context has been initialized, i.e.
QGLContext.setInitialized() has been called on it. If <i>on</i> is
false the context has not been initialized.</p>
<p><b>See also</b> <a href="qglcontext.html#initialized">initialized</a>().</p>


<h3 class="fn"><a name="setTextureCacheLimit" />QGLContext.setTextureCacheLimit (int&#160;<i>size</i>)</h3><p>This function sets the limit for the texture cache to
<i>size</i>, expressed in kilobytes.</p>
<p>By default, the cache limit is approximately 64 MB.</p>
<p><b>See also</b> <a href="qglcontext.html#textureCacheLimit">textureCacheLimit</a>().</p>


<h3 class="fn"><a name="setWindowCreated" />QGLContext.setWindowCreated (<i>self</i>, bool&#160;<i>on</i>)</h3><p>If <i>on</i> is true the context has had a window created for
it. If <i>on</i> is false no window has been created for the
context.</p>
<p><b>See also</b> <a href="qglcontext.html#windowCreated">windowCreated</a>().</p>


<h3 class="fn"><a name="swapBuffers" />QGLContext.swapBuffers (<i>self</i>)</h3><p>Swaps the screen contents with an off-screen buffer. Only works
if the context is in double buffer mode.</p>
<p><b>See also</b> <a href="qglformat.html#setDoubleBuffer">QGLFormat.setDoubleBuffer</a>().</p>


<h3 class="fn"><a name="textureCacheLimit" />int QGLContext.textureCacheLimit ()</h3><p>Returns the current texture cache limit in kilobytes.</p>
<p><b>See also</b> <a href="qglcontext.html#setTextureCacheLimit">setTextureCacheLimit</a>().</p>


<h3 class="fn"><a name="windowCreated" />bool QGLContext.windowCreated (<i>self</i>)</h3><p>Returns true if a window has been created for this context;
otherwise returns false.</p>
<p><b>See also</b> <a href="qglcontext.html#setWindowCreated">setWindowCreated</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>